#ifndef _TRACKER_H_
#define _TRACKER_H_

#include <string>
#include "torrent.h"
#include "net.h"
#include "bencode.h"

#include <iostream>
#include <limits>
using namespace std;

class Torrent;

class Tracker
{
public:
	// Tracker Data
	string GetTrackerHostName();
	string GetTrackerPort();
	string GetAnnounceDir();

	// BitTorrent Actions
	bool Connect();
	bool Disconnect();
	bool RequestPeers(unsigned num_peers);

private:
	string m_hostname;
	unsigned m_port;
	string m_announce_dir;

	Torrent *m_torrent;
	int m_socket;

	// Constructors are only available to Torrent class
	friend class Torrent;
	Tracker(Torrent *torrent, string hostname, unsigned port, string announce_dir);
	~Tracker();
};

#endif
